package com.ep.modules.app.controller;

import com.ep.common.annotation.SysLog;
import com.ep.common.utils.PageUtils;
import com.ep.common.utils.R;
import com.ep.common.validator.ValidatorUtils;
import com.ep.modules.app.entity.AppSettlementBasis;
import com.ep.modules.app.service.AppSettlementBasisService;
import java.util.Map;
import org.springframework.beans.factory.annotation.*;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/app/settlement_basis")
public class AppSettlementBasisController {
    @Autowired
    private AppSettlementBasisService appSettlementBasisService;

    @GetMapping("/list")
    public R list(Map<String, Object> params) {
        PageUtils page = appSettlementBasisService.queryPage(params);
        return R.ok().put("page", page);
    }

    @GetMapping("/info/{id}")
    public R info(@PathVariable Long id) {
        AppSettlementBasis appsettlementbasis = appSettlementBasisService.getById(id);
        return R.ok().put("appsettlementbasis", appsettlementbasis);
    }

    @SysLog("保存AppSettlementBasis")
    @PostMapping("/save")
    public R save(@RequestBody AppSettlementBasis appsettlementbasis) {
        ValidatorUtils.validateEntity(appsettlementbasis);
        appSettlementBasisService.save(appsettlementbasis);
        return R.ok();
    }

    @SysLog("修改AppSettlementBasis")
    @PostMapping("/update")
    public R update(@RequestBody AppSettlementBasis appsettlementbasis) {
        ValidatorUtils.validateEntity(appsettlementbasis);
        appSettlementBasisService.update(appsettlementbasis);
        return R.ok();
    }

    @SysLog("删除AppSettlementBasis")
    @PostMapping("/delete")
    public R delete(@RequestBody Long[] ids) {
        appSettlementBasisService.deleteBatch(ids);
        return R.ok();
    }
}